
<link 	type="text/css"	rel="stylesheet"	href="/assets/css/default.css" />


 		<p style="margin:50px">
		 <form id="form1" name="form1" class="easyui-form" method="post" data-options="novalidate:true" action ="">
		 <table cellpadding="10" border="0">


           <tr>
	         <td align="right">上传文件</td>
	         <td>
				<div class="thumb_box">
	           		<div  id="image_btn">
		           		<input class="easyui-filebox" name ="image"    style="width:300px"  id="uploadFileLogo" >
			    	 	<a href="javascript:void(0)" style="width:120px" class="easyui-linkbutton"    onclick="upload()">上       传</a>

	             	</div>
	             </div>
	        </td>
           </tr>
           	<tr >
				<td align="right">PDF附件:</td>
				<td align="left">
  					<input type="hidden"  name="id"  id="id"  value="<?php echo $info["id"] ?>">
	         	    <input type="hidden"  name="name"  id="name"  value="<?php echo $info["name"] ?>">
	         	     <input class="easyui-textbox easyui-validatebox"  type="text" id="filename" name="filename"  style="width:300px"
	    		 	data-options="required:true,novalidate:true"   missingMessage="请选择文件"   value="<?php echo $info["file_url"] ?>" >

                	<span style="color:#ff2e2e">*</span>
	             </td>
	    	</tr>

	   <tr style="">
    			<td  colspan="2" style="text-align:center;padding:15px">
       	   				<a href="javascript:void(0)" style="width:80%" class="easyui-linkbutton c9"  data-options=""    onclick="submitForm()">提            交</a>
                 </td>
	    	</tr>

		</table>
      </form>

<script type="text/javascript">

  function submitForm(){
						var arr=new Array();
							var url = "<?php echo $action_url ?>";
							var arr=new Array();
					        arr.push(new Array('filename','textbox'));
					        if(validate_arr(arr)){
			                     $.ajax({
									   type: "POST",
									   url:url,
									   dataType:"json",
									   data:$("#form1").serialize(),
									   success: function(msg){
										     var index = parent.layer.getFrameIndex(window.name);
											  parent.layer.msg("成功 ", {
													    icon: 1,  //1 成功 ,0 失败
													    time: 2000　//２　秒
													});

											  $("#iframe_src", parent.document)[0].contentWindow.load_attachment(<?php echo $info["id"] ?>);
											  parent.layer.close(index);
									   }
								});
					        }




		}



</script>


<script type="text/javascript">

	$('#uploadFileLogo').filebox({
		buttonText: '选择文件',
	    buttonAlign: 'right'
	});

   function upload() {
			var  url  ="<?php echo site_url('/admin/archive/upload') ?>";
		    $.ajaxFileUpload({
		        fileElementId: "filebox_file_id_2",
		        url: url,
		        data:{"file":"image"},
		        dataType: 'json',
		        success: function(data) {
		        	//alert(data);
		        	if(data.status == "1")  {
			         	 $("#filename").textbox('setValue',data.filename);
		        	 }else{
		        		 showmsg(data.message);
		        	 }
		        },
		        error: function(d, s, e) {

		        }
		    });
	}



</script>

</body>
</html>